<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <title>首页</title>
    <link rel="stylesheet" th:href="@{/css/style.css}">
</head>

<body>
<div class="content">
    <div class="form sign-in">
        <h2>欢迎回来</h2>
        <p style="color: red;text-align: center" th:text="${msg}" th:if="${not #strings.isEmpty(msg)}"></p>
        <form th:action="@{/user/login}" method="post" onsubmit="login_pwd_md5()">
            <label>
                <span>邮箱</span>
                <input type="email" name="email"/>
            </label>
            <label>
                <span>密码</span>
                <input type="password" id="loginPassword"/>
                <input type="hidden" name="password" id="md5_loginPassword">
            </label>
            <p class="forgot-pass"><a href="javascript:">忘记密码？</a></p>
            <button type="submit" class="submit">登 录</button>
<!--            <button type="button" class="fb-btn">使用 <span>facebook</span> 帐号登录</button>-->
        </form>

    </div>
    <div class="sub-cont">
        <div class="img">
            <div class="img__text m--up">
                <h2>还未注册？</h2>
                <p>立即注册，发现大量机会！</p>
            </div>
            <div class="img__text m--in">
                <h2>已有帐号？</h2>
                <p>有帐号就登录吧，好久不见了！</p>
            </div>
            <div class="img__btn">
                <span class="m--up">注 册</span>
                <span class="m--in">登 录</span>
            </div>
        </div>
        <div class="form sign-up">
            <h2>立即注册</h2>
            <form th:action="@{/user/register}" onsubmit="pwd_md5()">
                <label>
                    <span>用户名</span>
                    <input type="text" class="input" name="username" data-validate="required:必填" />
                </label>
                <label>
                    <span>邮箱</span>
                    <input type="email" name="email" />
                </label>
                <label>
                    <span>密码</span>
                    <input type="password" id="input_pwd" />
                    <input type="hidden" id="md5_pwd" name="password">
                </label>
                <button type="submit" class="submit">注 册</button>
<!--                <button type="button" class="fb-btn">使用 <span>facebook</span> 帐号注册</button>-->
            </form>

        </div>
    </div>
</div>

<script th:src="@{/js/md5.js}"></script>
<script th:src="@{/js/script.js}"></script>
<script>
    layui.use(['layer', 'form'], function(){
        var layer = layui.layer
            ,form = layui.form;

        layer.msg('Hello World');
    });



    function pwd_md5(){
        let md5_pwd =document.getElementById('md5_pwd');
        md5_pwd.value = hex_md5(document.getElementById('input_pwd'));
        alert("注册成功！")
        return true;
    }

    function login_pwd_md5(){
        let md5_loginPassword =document.getElementById('md5_loginPassword');
        md5_loginPassword.value = hex_md5(document.getElementById('loginPassword'));
        // alert("注册成功！")
        return true;
    }


</script>


</body>

</html>
